many to one


In [2]:
include("my_Gale_Shap.jl")


Out[2]:
my_Gale_Shap (generic function with 2 methods)

Example


In [3]:
Pkg.update("https://github.com/oyamad/Matching.jl")


LoadError: MethodError: `update` has no method matching update(::ASCIIString)
while loading In[3], in expression starting on line 1

In [4]:
using Matching

In [5]:
prop_prefs, resp_prefs = random_prefs(4, 3);

In [6]:
prop_prefs


Out[6]:
4x4 Array{Int64,2}:
 3  1  2  2
 2  2  0  0
 0  3  3  3
 1  0  1  1

In [7]:
resp_prefs


Out[7]:
5x3 Array{Int64,2}:
 3  1  1
 0  4  4
 2  3  2
 4  0  0
 1  2  3

In [8]:
my_Gale_Shap(prop_prefs, resp_prefs)


Out[8]:
([3,0,0,2],[0,4,1])

In [9]:
s_prefs, c_prefs, caps = random_prefs(4, 3, ReturnCaps);

In [10]:
s_prefs


Out[10]:
4x4 Array{Int64,2}:
 3  3  2  1
 2  2  3  3
 0  0  1  0
 1  1  0  2

In [11]:
c_prefs


Out[11]:
5x3 Array{Int64,2}:
 1  4  2
 4  0  1
 3  1  4
 2  3  0
 0  2  3

In [12]:
caps


Out[12]:
3-element Array{Int64,1}:
 3
 2
 4

In [13]:
my_Gale_Shap(s_prefs, c_prefs, caps)


Out[13]:
([3,3,1,1],[4,3,0,0,0,2,1,0,0],[1,4,6,10])

In [14]:
Pkg.add("BaseTestNext")


INFO: Nothing to be done

In [15]:
include("test_deferred_acceptance.jl")


Test Summary:           | Pass  Total
Testing my_Gale_Shap.jl |   10     10
Out[15]:
BaseTestNext.DefaultTestSet("Testing my_Gale_Shap.jl",Any[BaseTestNext.DefaultTestSet("my_Gale_Shap: one-to-one",Any[Test Passed
  Expression: m_matched_computed == m_matched_expected
   Evaluated: [1,2,3,0] == [1,2,3,0],Test Passed
  Expression: f_matched_computed == f_matched_expected
   Evaluated: [1,2,3] == [1,2,3],Test Passed
  Expression: m_matched_computed == m_matched_expected
   Evaluated: [1,2,3,0] == [1,2,3,0],Test Passed
  Expression: f_matched_computed == f_matched_expected
   Evaluated: [1,2,3] == [1,2,3]],false),BaseTestNext.DefaultTestSet("my_Gale_Shap: many-to-one with caps 1",Any[Test Passed
  Expression: m_matched_computed == m_matched_expected
   Evaluated: [1,2,3,0] == [1,2,3,0],Test Passed
  Expression: f_matched_computed == f_matched_expected
   Evaluated: [1,2,3] == [1,2,3],Test Passed
  Expression: indptr_computed == indptr_expected
   Evaluated: [1,2,3,4] == [1,2,3,4]],false),BaseTestNext.DefaultTestSet("my_Gale_Shap: many-to-one",Any[Test Passed
  Expression: s_matched_computed == s_matched_expected
   Evaluated: [3,1,4,3,1,3,2,1,4,1,5] == [3,1,4,3,1,3,2,1,4,1,5],Test Passed
  Expression: indptr_computed == indptr_expected
   Evaluated: [1,5,6,9,11,12] == [1,5,6,9,11,12],Test Passed
  Expression: c_matched_computed == c_matched_expected
   Evaluated: [2,5,8,10,7,1,4,6,3,9,11] == [2,5,8,10,7,1,4,6,3,9,11]],false)],false)

In [ ]: